-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add cli command size
#215
Conversation
Codecov Report
@@ Coverage Diff @@
## main #215 +/- ##
==========================================
+ Coverage 80.18% 80.39% +0.20%
==========================================
Files 13 13
Lines 1413 1433 +20
Branches 535 537 +2
==========================================
+ Hits 1133 1152 +19
- Misses 109 110 +1
Partials 171 171
Continue to review full report at Codecov.
|
bytes += stat.size; | ||
} | ||
} | ||
stdout.push(`${bytes} bytes total`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be preferable to make this KB by default, or choose between bytes or not. Here's an example function - https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string/14919494#14919494.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could potentially leverage pretty-bytes
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started going down that road but I wasn't sure if we wanted to use base 2 (1024) or base 10 (1000) to mean 1KB (I'll need to verify how the API does it) so I left that for a follow up PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps at least use numeric separators with a standard format like 123,456,789B
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great addition
Instead of
nft build index.js && du -sh dist
, this introduces a new command:nft size index.js
.I also updated the CLI output to be a little friendlier: